package com.example.administrator.wallet.adapter;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.wallet.R;

import java.util.List;

/**
 * Effect:
 * <p>
 * Author:  CaiYapeng
 * <p>
 * Time  :  2018/7/9.
 */
public class BackupsGridAdapter extends BaseAdapter{
    private List<String> datas;
    private Context context;
    public BackupsGridAdapter(Activity backupsActivity, List<String> datas) {
        this.context=backupsActivity;
        this.datas=datas;
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if(view==null){
            holder=new ViewHolder();
            view=View.inflate(context, R.layout.backups_grid_item,null);
            view.setTag(holder);
        }else{
            holder = (ViewHolder) view.getTag();
        }
        holder.content= (TextView) view.findViewById(R.id.content);

        holder.content.setText(datas.get(i));
        return view;
    }

    private class ViewHolder{
        private TextView content;
    }
}
